package com.linhui.project.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.linhui.project.common.BaseResponse;
import com.linhui.project.common.ErrorCode;
import com.linhui.project.common.ResultUtils;
import com.linhui.project.exception.BusinessException;
import com.linhui.project.manager.SearchFacade;
import com.linhui.project.model.dto.post.PostQueryRequest;
import com.linhui.project.model.dto.search.SearchRequest;
import com.linhui.project.model.dto.user.UserQueryRequest;
import com.linhui.project.model.entity.Picture;
import com.linhui.project.model.enums.SearchTypeEnum;
import com.linhui.project.model.vo.PostVO;
import com.linhui.project.model.vo.SearchVO;
import com.linhui.project.model.vo.UserVO;
import com.linhui.project.service.PictureService;
import com.linhui.project.service.PostService;
import com.linhui.project.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.naming.directory.SearchResult;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

/**
 * @author: 临晖
 * @since: 2024-05-18
 */


@RestController
@RequestMapping("/search")
@Slf4j
public class SearchController {


    @Resource
    private SearchFacade searchFacade;


    @PostMapping("/all")
    public BaseResponse<SearchVO> searchAll(@RequestBody SearchRequest searchRequest, HttpServletRequest httpServletRequest) {

        SearchVO searchVO = searchFacade.searchAll(searchRequest, httpServletRequest);
        return ResultUtils.success(searchVO);

    }


}
